package com.iwdnb.gkgz.application.service.router.strategyTradeStatistic;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import com.iwdnb.gkgz.application.model.vo.StrategyTradeScore;
import com.iwdnb.gkgz.application.service.StrategyTradeStatisticService;
import com.iwdnb.gkgz.common.model.dto.StrategyTradeDTO;
import com.iwdnb.service.router.annotation.Router;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

@Service
@Slf4j
@Router(interfaceClass = StrategyTradeStatisticService.class)
public class BaseStrategyTradeStatisticService implements StrategyTradeStatisticService {

    @Override
    public Map<String, List<StrategyTradeDTO>> statisticTradeList(String group, String parentGroup,
        List<StrategyTradeDTO> strategyTradeList) {
        return null;
    }



    public Map<String, List<StrategyTradeDTO>> formatStatisticMap(String group, String parentGroup,
        Map<String, List<StrategyTradeDTO>> statisticMap) {
        if (MapUtils.isEmpty(statisticMap)) {
            return statisticMap;
        }
        Map<String, List<StrategyTradeDTO>> map = new LinkedHashMap<>();
        for (Entry<String, List<StrategyTradeDTO>> entry : statisticMap.entrySet()) {
            String key = group + ":" + entry.getKey();
            if (StringUtils.isNotBlank(parentGroup)) {
                key = parentGroup + "," + key;
            }
            map.put(key, entry.getValue());
        }
        return map;
    }
}
